package com.cq.hd.member.controller;

import com.cq.hd.common.response.Result;
import com.cq.hd.common.response.ResultGenerator;
import com.cq.hd.member.api.SmsApi;
import com.cq.hd.member.api.dto.SmsDto;
import com.cq.hd.member.api.dto.SmsVerifyDto;
import com.cq.hd.member.biz.SmsBiz;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class SmsController implements SmsApi {

    @Autowired
    private SmsBiz smsBiz;

    @ApiOperation(value = "发送短信验证码")
    @ApiImplicitParam(name = "smsDto", value = "发送短信验证码参数", paramType = "body", dataType = "SmsDto")
    @ApiResponse(response = String.class, code = 200, message = "接口返回对象参数")
    @Override
    public Result<Object> sendSms(@RequestBody SmsDto smsDto) {
        return smsBiz.sendSms(smsDto);
    }

    @ApiOperation(value = "校验短信")
    @ApiImplicitParam(name = "smsVerifyDto", value = "校验短信参数", paramType = "body", dataType = "SmsVerifyDto")
    @ApiResponse(response = String.class, code = 200, message = "接口返回对象参数")
    @Override
    public Result<Object> verify(@RequestBody SmsVerifyDto smsVerifyDto) {
        return smsBiz.verify(smsVerifyDto);
    }
}
